// $(function() {
	var mainForm = $('#main-form');

	new Upload({
		elem: 'add-img-btn',
		url: '/Api/Upload/ajax_more_img',
		name: 'Filedata[]',
		formId: 'upload-form',
		inputId: 'file-upload-input',
		beforeAjax: function() {
			var imgs = this.btn.siblings('.list'); 
			if (imgs.length >= 4) {
				$.alert('最多上传4张');
				return false;
			}
			return true;
		}
	}); 

	mainForm.validate();
	mainForm.on('submit', function() {
		try {
			if(mainForm.valid()) {
				mainForm.submitForm();
			}
		}catch(e) {
			console.error(e);
		}

		return false;
	});

	var status = $('#goods_desc').data('status');
	if (status == 0) {
		var ue = UE.getEditor('goods_desc', {
		    readonly: true,
		    autoFloatEnabled: false,
		    initialFrameWidth: 830,
		    initialFrameHeight: 400,
		})
	}else{
		var ue = UE.getEditor('goods_desc', {
		    readonly: false,
		    autoFloatEnabled: false,
		    initialFrameWidth: 830,
		    initialFrameHeight: 400,
		})
	}
// });